//
//  Qb_MessageViewController.m
//  Cd_Qb
//
//  Created by mac on 2018/3/8.
//  Copyright © 2018年 mac. All rights reserved.
//

#import "Qb_MessageViewController.h"
#import "Qb_MessageTableViewCell.h"
#import "Qb_MessageListViewController.h"

static NSString * ID = @"MessageCell";

@interface Qb_MessageViewController ()<UITableViewDelegate,UITableViewDataSource>
//假导航栏
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *Qb_MessageNavH;
//时间
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *Qb_MessageNavLabelRight;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *Qb_MessageNavLabelBottom;
//标签
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *Qb_MessageNavLabelBottom01;
//tableView
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *Qb_MessageTableViewTop;


@property (weak, nonatomic) IBOutlet UITableView *MessagetableView;

@property (nonatomic, strong) NSArray * dataArray;
@property (nonatomic, strong) NSArray * imageArray;
@end

@implementation Qb_MessageViewController

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    self.navigationController.navigationBar.hidden = YES;
    self.tabBarController.tabBar.hidden = NO;

}



- (void)viewDidLoad {
    [super viewDidLoad];
    [self AdaptationApp];
    
    self.MessagetableView.delegate = self;
    self.MessagetableView.dataSource = self;
    self.MessagetableView.rowHeight = 64*AdaptiveScale_H;
    self.dataArray = @[@"系统消息",@"充值消息",@"分润返佣",@"支付消息",@"转账消息"];
    self.imageArray = @[@"messageIcon_xt",@"messageIcon_cz",@"messageIcon_fr",@"messageIcon_pay",@"messageIcon_zz"];
    kDevice_Is_iPhoneX?(self.Qb_MessageNavH.constant = 88):(self.Qb_MessageNavH.constant = 64);
    
    self.MessagetableView.separatorStyle = UITableViewCellSelectionStyleNone;
    self.MessagetableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 5;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    Qb_MessageTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (!cell)
    {
        cell = [Qb_MessageTableViewCell messageTableViewCell];
        
    }
    cell.numView.hidden = YES;
    cell.textLB.text = self.dataArray[indexPath.row];
    cell.iconImg.image = [UIImage imageNamed:self.imageArray[indexPath.row]];
    if (indexPath.row == 2)
    {
        cell.number.text = @"3";
        cell.numView.hidden = NO;
    }
    
    
    return cell;
}


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    Qb_MessageListViewController * myBill = (Qb_MessageListViewController*)Storyboard(@"MessageListView", @"MessageListView");
    myBill.hidesBottomBarWhenPushed = YES;
    [self.navigationController pushViewController:myBill animated:YES];
}

@end
